package com.buddies.lottery.ui.lottery;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.bean.LotteryCategory;
import com.buddies.lottery.data.result.PageResult;

/**
 * Created by xuliang on 2018/2/28.
 */

public class LotteryPresenter extends BasePresenter<LotteryContract.View> implements LotteryContract.Presenter {

    public LotteryPresenter(LotteryContract.View view) {
        super(view);
    }

    @Override
    public void loadLotteryCategoryList() {
        addSubscription(DataManager.getInstance().getLotteryRepo().getLotteryCategoryList(), new BaseObserver<PageResult<LotteryCategory>>() {
            @Override
            public void onNext(PageResult<LotteryCategory> response) {
                mView.onLotteryCategoryListLoaded(response);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        });
    }

}
